package com.ethink.warehouse.api.request;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

/**
 * 物流跟进单 新增请求对象
 *
 * @author default
 * @date 2022-11-10
 */
@Data
public class LogisticsTraceOrderAddRequest {

    @Schema(description ="始发仓编码")
    private String sourceWarehouseCode;

    @Schema(description ="始发仓名称")
    private String sourceWarehouseName;

    @Schema(description ="目的仓编码")
    private String targetWarehouseCode;

    @Schema(description ="目的仓名称")
    private String targetWarehouseName;

    @Schema(description ="枚举 运输方:1-我方(t1)|2-供应商(t2)|3-客户(t3)|4-虚拟(t4)")
    @NotNull(message = "运输方不能为空")
    private Integer transportEntity;

    @Schema(description ="枚举 目的主体类型:1-供应商(t1)|2-客户(t2)|3-分仓(t3)")
    @NotNull(message = "目的主体类型不能为空")
    private Integer targetEntityType;

    @Schema(description ="枚举 始发主体类型:1-供应商(t1)|2-客户(t2)|3-分仓(t3)")
    @NotNull(message = "始发主体类型不能为空")
    private Integer sourceEntityType;

    @Schema(description ="创建人账号")
    private String createUserCode;

    @Schema(description ="创建人名称")
    private String createUserName;

    @Schema(description ="提单号")
    private String takeOrderNo;

    @Schema(description ="始发国")
    private String sourceCountry;

    @Schema(description ="始发港")
    private String sourcePort;

    @Schema(description ="目的国")
    private String targetCountry;

    @Schema(description ="目的港")
    private String targetPort;

    @Schema(description ="货代物流")
    private String expressCompany;

    @Schema(description ="运输方式")
    private String transportModel;

    @Schema(description ="送货模式")
    private String deliveryModel;

    @Schema(description ="托")
    private String torr;

    @Schema(description ="箱")
    private String box;

    @Schema(description ="预计发货日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date expireFhTime;

    @Schema(description ="实际发货日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date actualFhTime;

    @Schema(description ="预计到港日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date expireDgTime;

    @Schema(description ="实际到港日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date actualDgTime;

    @Schema(description ="预计到仓日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date expireDcTime;

    @Schema(description ="实际到仓日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date actualDcTime;

    @Schema(description ="实际理货日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date actualLhTime;

    @Schema(description ="实际上架日期")
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern = "yyyy-MM-dd",timezone = "GMT+8")
    private Date actualSjTime;

    @Schema(description ="运输费用")
    private BigDecimal transportCostAmt;

    @Schema(description ="备注信息")
    private String remark;

    @Schema(description = "明细")
    @NotNull(message = "明细不能为空")
    @NotEmpty(message = "明细不能为空")
    private List<LogisticsTraceOrderAddRequestMateItem> items;

    @Data
    public static class LogisticsTraceOrderAddRequestMateItem {
        @Schema(description = "申请单主键")
        @NotNull(message = "申请明细主键不能为空")
        private Long id;

        @Schema(description ="实际申请数量")
        @NotNull(message = "实际申请数量不能为空")
        private Integer traceQty;

        @Schema(description ="报关分仓编码")
        private String bkSubWarehouseCode;

        @Schema(description ="报关分仓名称")
        private String bkSubWarehouseName;
    }

}
